/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;

/**
 *
 * @author roniere
 */
/**
 * Categoria
 *
 * @author roniere
 */
@Entity
public class Category implements Serializable {

    @Id
    @SequenceGenerator(name = "seq_category", sequenceName = "seq_category", allocationSize = 1)
    @GeneratedValue(generator = "seq_category", strategy = GenerationType.SEQUENCE)
    private Long id;
    
    @Column
    private Long cod;
    
    @Column
    private String name;
    
    @JoinTable(name="category_issues")
    @OneToMany(fetch= FetchType.EAGER)
    private List<Issues> issueses;
    
    
    public Category() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getCod() {
        return cod;
    }

    public void setCod(Long cod) {
        this.cod = cod;
    }

 

    public List<Issues> getIssueses() {
        return issueses;
    }

    public void setIssueses(List<Issues> issueses) {
        this.issueses = issueses;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 41 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Category other = (Category) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Category{" + "id=" + id + ", name=" + name + ", issueses=" + issueses + '}';
//        return name;
    }

   

    
}
